#include <iostream>
#include <unordered_map>
using namespace std;

class Solution
{
public:
    char findTheDifference(string s, string t)
    {
        if (s.empty())
        {
            return t[0];
        }
        unordered_map<char, int> mp;
        

        for (auto e1 : t)
        {
            if (mp.find(e1) != mp.end())
                mp[e1]++;
            else
                mp.emplace(e1, 1);
        }

        for (auto e2 : s)
        {
            mp[e2]--;
        }
        for (auto e : mp)
        {
            if (e.second != 0)
            {
                return e.first;
            }
        }
    }
};
int main()
{
    string s1{ "aabcd" };
    string s2{ "aabcde" };

    Solution xz;
    char a = xz.findTheDifference(s1, s2);

    cout << a << endl;

    /*unordered_map<char, int> mp = { {'a',1},{'b',1} ,{'c',1} };
    mp['a']++;
    for (auto &e : mp)
    {
        cout << e.first << " " << e.second << endl;
    }*/


	return 0;
}